# PyWWT

Brings the magic of [Wiimms WBFS Tool](https://wit.wiimm.de/) to Python.

## This is WIP, do not use yet!

 - It is incomplete
 - It is not enough tested
 - The API may change at anytime

### Dependencies

| Name   | Version | License | URL |
| :----- | :------ | :------ | :-- |
| libwwt | TODO    | TODO    | https://notabug.org/CYBERDEViL/libwwt |

### Methods

```
pywwt.version()
pywwt.find_wbfs_partitions()
pywwt.get_wbfs_partition_info(partition, includeDiscs=False)
pywwt.check_wbfs_partition(partition)
pywwt.repair_wbfs_partition(partition, repairMode=pywwt.REPAIR_ALL, testMode=True)
pywwt.extract_from_wbfs(partition, id6, dest, testMode=True)
pywwt.add_to_wbfs(partition, gamefile, testMode=True)
pywwt.remove_from_wbfs(partition, id6, testMode=True)
```

### Examples

```python
print(pywwt.version())

  {
    "version": "3.05a",
    "rev": "8638",
    "arch": "x86_64"
  }
```

```python
print(pywwt.find_wbfs_partitions())

  ['/dev/sdb1']
```

```python
print(pywwt.get_wbfs_partition_info("/dev/sdb1", includeDiscs=True))

  {
    "discs": [
      {
        "id6": "RMCP01",
        "title": "Mario Kart Wii (Wiimmfi)",
        "region": 2,
        "slot": 0,
        "size": 2648,
        "ftype": 524292
      }
    ],
    "discs_max": 215,
    "used": 2648,
    "free": 26676,
    "wbfs_version": 1
  }
```

```python
print(pywwt.check_wbfs_partition("/dev/sdb1"))

  {
    "status": 0,
    "error_count": 0,
    "invalid_disc_count": 0,
    "errors": {
      "used_blocks": 0,
      "free_blocks": 0,
      "free_wbfs0": 0,
      "overlap": 0,
      "ref_blocks": 0,
      "disc_blocks": 0
    }
  }
```